import React from 'react';
import {HashRouter, Route, Routes} from "react-router-dom";
import Index from '../Pages/index'
import Login from "../Pages/Login";
import Redirect from "../components/Redirect";
function AuthComponent({children}){
    const isLogin = localStorage.getItem("Token")
    return isLogin?children:<Redirect to="/login"/>
}
const MRouter = () => {

    return (
        <div>
            <HashRouter>
                <Routes>
                    <Route path={"/index"} element={<AuthComponent>
                        <Index>

                        </Index>
                    </AuthComponent>}></Route>
                    <Route path={"/Login"} element={<Login/>}></Route>
                </Routes>
            </HashRouter>

        </div>
    );
};

export default MRouter;
